{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Name: tushare\n",
      "Version: 1.4.14\n",
      "Summary: A utility for crawling historical and Real-time Quotes data of China stocks\n",
      "Home-page: https://tushare.pro\n",
      "Author: Jimmy Liu\n",
      "Author-email: waditu@163.com\n",
      "License: BSD\n",
      "Location: C:\\Users\\王\\AppData\\Local\\Packages\\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\\LocalCache\\local-packages\\Python312\\site-packages\n",
      "Requires: bs4, lxml, pandas, requests, simplejson, tqdm, websocket-client\n",
      "Required-by: \n",
      "Note: you may need to restart the kernel to use updated packages.\n"
     ]
    }
   ],
   "source": [
    "%pip show tushare"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "        ts_code trade_date   open   high    low  close  pre_close  change  \\\n",
      "0     920128.BJ   20241231  28.97  29.59  28.51  28.78      28.81   -0.03   \n",
      "1     920118.BJ   20241231  24.30  25.15  24.02  24.40      24.20    0.20   \n",
      "2     920111.BJ   20241231  23.57  24.58  23.57  23.92      23.41    0.51   \n",
      "3     920106.BJ   20241231  59.50  63.43  58.02  60.00      57.73    2.27   \n",
      "4     920099.BJ   20241231  28.59  29.20  28.15  28.84      28.13    0.71   \n",
      "...         ...        ...    ...    ...    ...    ...        ...     ...   \n",
      "5995  688228.SH   20241230  48.00  48.50  46.20  47.15      48.03   -0.88   \n",
      "5996  688227.SH   20241230  26.91  27.98  26.05  27.13      27.12    0.01   \n",
      "5997  688226.SH   20241230  26.30  26.58  25.39  25.46      26.70   -1.24   \n",
      "5998  688225.SH   20241230  18.99  19.58  18.83  19.18      19.35   -0.17   \n",
      "5999  688223.SH   20241230   7.40   7.45   7.26   7.31       7.43   -0.12   \n",
      "\n",
      "      pct_chg        vol      amount  \n",
      "0     -0.1041   12409.19   36137.094  \n",
      "1      0.8264    4440.71   10974.221  \n",
      "2      2.1786   23122.29   55752.992  \n",
      "3      3.9321   20306.42  123226.088  \n",
      "4      2.5240    6811.02   19587.924  \n",
      "...       ...        ...         ...  \n",
      "5995  -1.8322   13711.70   65256.476  \n",
      "5996   0.0369    7965.79   21478.852  \n",
      "5997  -4.6442   51044.74  132505.424  \n",
      "5998  -0.8786   18051.19   34771.579  \n",
      "5999  -1.6151  460780.61  337447.061  \n",
      "\n",
      "[6000 rows x 11 columns]\n"
     ]
    }
   ],
   "source": [
    "import tushare as ts\n",
    "\n",
    "\n",
    "ts.set_token('a5cf1ab551ad138a26892ade5477d92ff23d698e8347cb2b2bcc37d4')\n",
    "pro = ts.pro_api()\n",
    "\n",
    "params = {\n",
    "    \"ts_code\": \"601939.SH\",\n",
    "    \"trade_date\": \"\",\n",
    "    \"start_date\": 20100101,\n",
    "    \"end_date\": 20241225,\n",
    "    \"offset\": \"\",\n",
    "    \"limit\": \"\",\n",
    "    \"fields\": [\n",
    "        \"ts_code\",\n",
    "        \"trade_date\",\n",
    "        \"open\",\n",
    "        \"high\",\n",
    "        \"low\",\n",
    "        \"close\",\n",
    "        \"pre_close\",\n",
    "        \"change\",\n",
    "        \"pct_close\",\n",
    "        \"change\",\n",
    "        \"pct_chg\",\n",
    "        \"vol\",\n",
    "        \"amount\"\n",
    "    ]\n",
    "}\n",
    "df = pro.daily(params)\n",
    "print(df)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
